namespace :laravel do
  task :migrate do
    on roles fetch(:migrate_roles) do
      within release_path do
        execute './artisan', 'migrate', fetch(:migrate_flags)
      end
    end
  end

  task :restart_queue do
    on roles fetch(:queue_roles) do
      within release_path do
        execute './artisan', 'queue:restart'
      end
    end
  end
end

namespace :load do
  task :defaults do
    set :migrate_flags, %w(--force)
    set :migrate_roles, :all
    set :queue_roles, :all
  end
end
